package tsing.javase.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @Author Tsing/吴清平
 * @Date 2022/10/17 11:17
 * @Version 1.0
 */
@Component
public class TsingConfig {

    @Value("${tsing.name}")
    private String name;

    @Value("${tsing.age}")
    private int age;

    private static TsingConfig tsingConfig;

    public @PostConstruct
    void init () {
        tsingConfig = this;

    }


    public void test(){
        System.out.println(name);
        System.out.println(age);

    }

    public static void test2(){
        System.out.println(tsingConfig.name);
        System.out.println(tsingConfig.age);

    }

}
